$dir = "/data4/bsi/refdata/FASTA/Homo_sapiens.UCSC_HG19";

$k =`ls $dir`;
@k = split(/\n/,$k);
for($i=0;$i<@k;$i++)
{
	if($k[$i] =~ m/\.fa/)
	{
	
		open(FILE,"$dir/$k[$i]");
		$k[$i] =~ s/chr//g;
		$k[$i] =~ s/\.fa//g;
		
		$line=<FILE>;
		$length = 0;
		while(<FILE>)
		{
        		#print $_;
        		chomp($_);
        		$length = $length+length($_);
		}
		print $k[$i]."\t".$length."\n";
	}
}
